package net.atomarrow.controllers.converter;


public class ArrayConverter implements IConverter {

    @Override
    public boolean canHandle(Class clazz) {
        return clazz.isArray();
    }

    @Override
    public <T> T converter(Object[] values, Class<T> clazz) throws Exception{
        if(values.length>1){
            return (T) values;
        }
        String value = values[0].toString();
        if(value.contains(",")){
            return (T) value.split(",");
        }
        return (T) values; 
    }
}
